<?php
/**
 * abstraction d'un backend de sortie de log
 * @package log 
 * @author Alain Vagner
 */
abstract class Appender
{
	protected $level;
	protected $config;
	
	public function __construct($level, $config)
	{
		$this->level = $level;
		$this->config = $config;	
	}
	
	public function log($logitem)
	{
			if ($logitem->gravite >= $this->level) {
				 $this->write($logitem);
			}	
		
	}
	
	abstract public function write($logitem);

	
	public function getLevel($i)
	{
		 switch ($i) {
			case Logger::debug_level:
				return "DEBUG";
			case Logger::info_level:
				return "INFO";
			case Logger::warning_level:
				return "WARNING";
			case Logger::error_level:
				return "ERROR";
			case Logger::fatal_level:
				return "FATAL";	 	
		 } 
	}
}
?>
